﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework - CNR Framework Section
 * Version 2.10
 * 
 * CNR Command Receieved Event Arguments Class
 *      Provides an event arguments base class for CNR command-reception events.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using Adaptive.Foundation;

namespace Adaptive.Foundation.Network.Cnr
{
    /// <summary>
    /// Provides an event arguments base class for CNR command-reception events.
    /// </summary>
    /// <remarks>
    /// This class is intended to act as the base definition for the event arguments
    /// classes user to indicate that a command has been received for processing.
    /// </remarks>
    public class CnrCommandReceptionEventArgs : System.EventArgs
    {
        /*--------------------------------------------------------------------------------
         * Private Member Declarations
         *------------------------------------------------------------------------------*/
        #region Private Member Declarations
        /// <summary>
        /// Command that was received.
        /// </summary>
        private CnrCommandBase _command;
        /// <summary>
        /// Raw data received.
        /// </summary>
        private string _rawData;
        #endregion

        /*--------------------------------------------------------------------------------
         * Constructor / Dispose / Destructor Methods
         *------------------------------------------------------------------------------*/
        #region Constructor / Dispose / Destructor Methods
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <remarks>
        /// This is the default constructor.
        /// </remarks>
        public CnrCommandReceptionEventArgs()
            : base()
        {
            _rawData = string.Empty;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="command">
        /// The <see cref="CnrCommandBase"/> instance received.
        /// </param>
        public CnrCommandReceptionEventArgs(CnrCommandBase command)
            : base()
        {
            _command = command;
            _rawData = string.Empty;
            
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="rawData">The raw data received as a command.</param>
        public CnrCommandReceptionEventArgs(string rawData)
            : base()
        {
            _command = null;
            _rawData = rawData;
        }
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="command">
        /// The <see cref="CnrCommandBase"/> instance received.
        /// </param>
        /// <param name="rawData">The raw data received as a command.</param>
        public CnrCommandReceptionEventArgs(CnrCommandBase command, string rawData)
            : base()
        {
            _command = command;
            _rawData = rawData;
        }
        /// <summary>
        /// Class destructor.
        /// </summary>
        ~CnrCommandReceptionEventArgs()
        {
            _command = null;
            _rawData = null;
        }
        #endregion

        /*--------------------------------------------------------------------------------
         * Public Properties
         *------------------------------------------------------------------------------*/
        #region Public Properties
        /// <summary>
        /// Gets the reference to the command that was received.
        /// </summary>
        /// <value>
        /// A <see cref="CnrCommandBase"/> instance, or <b>null</b>.
        /// </value>
        public CnrCommandBase Command
        {
            get { return _command; }
        }
        /// <summary>
        /// Gets the text of the raw data that was received.
        /// </summary>
        /// <value>
        /// Raw data text, an empty string, or <b>null</b>.
        /// </value>
        public string RawData
        {
            get { return _rawData; }
        }
        #endregion
    }
}